<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>事件委托</title>
</head>
<body>
    <ul>
        <li>1</li>
        <li>2</li>
    </ul>
    <script>
        let ul = document.querySelector('ul')
        ul.onclick = function (e){
            e.target.style.color = 'red'
        }
    </script>
</body>
</html>
